package com.example.testapplication.ui.mine;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.example.testapplication.ui.browser.BrowserActivity;
import com.example.testapplication.ui.bubble.BubbleActivity;
import com.example.testapplication.ui.home.home_list_fragment.MutiItemTypeAViewModel;
import com.example.testapplication.ui.imageselect.ImageSelectActivity;
import com.example.testapplication.ui.userdata.UserDataActivity;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.ItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.utils.ToastUtils;

public class MineItemViewModel extends ItemViewModel<MineViewModel> {

    public MineItemViewModel(@NonNull MineViewModel viewModel,String text) {
        super(viewModel);
        this.text.set(text);
    }

    public ObservableField<String> text = new ObservableField<>("");



    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            int position = viewModel.observableList.indexOf(MineItemViewModel.this);
            switch (viewModel.observableList.get(position).text.get()){
                case "气泡":
                    viewModel.startActivity(BubbleActivity.class);
                    break;
                case "个人资料":
                    viewModel.startActivity(UserDataActivity.class);
                    break;
                case "选择图片":
                    viewModel.uc.pClickEvent.setValue(2);
                    break;
                case "网页":
                    BrowserActivity.start(viewModel.getApplication(), "https://view.officeapps.live.com/op/view.aspx?src=http://r9a2nn5zi.bkt.clouddn.com/sssss.xlsx");
                    break;
            }
        }
    });
}
